import React, { Component } from 'react'
import MainBanner from './MainBanner'
import MainProductList from './MainProductList'
import axios from 'axios'

export class Main extends Component {
  constructor() {
    super()
    this.state = {
      message: 'main',
      banner: [],
      productList: [],
    }
  }
  render() {
    const { banner, productList } = this.state
    return (
      <div className="main">
        <div>Main</div>
        <MainBanner banner={banner}></MainBanner>
        <MainProductList productList={productList}></MainProductList>
      </div>
    )
  }
  componentDidMount() {
    axios.get('http://123.207.32.32:8000/home/multidata').then((res) => {
      console.log(res)
      this.setState({
        banner: res.data.data.banner.list,
        productList: res.data.data.recommend.list,
      })
    })
  }
}

export default Main
